home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 2,801 to 2,900
/
aol-file-protocol-4400-2801-to-2900.zip
/
AOLDLs
/
C++ Files Library
/
Point_Rect C++ Classes
/
MacObj.sit
/
MacObj ƒ
/
CRect.note
< prev
next >
Wrap
Text File
|
1993-09-15
|
4KB
|
129 lines
class CRect : public Rect
The CRect class is based on the Macintosh Rect structure and includes
methods that operate on CRect and Rect structures. A CRect object can
be used wherever a Rect structure is used.
The Macintosh Rect structure is defined as:
struct Rect {
short top;
short left;
short bottom;
short right;
};
To use this class include the header file CRect.h.
Constructors:
CRect();
Constructs a CRect object. Members are not initialized.
CRect(short l, short t, short r, short b);
Constructs a CRect object. Members left, top, right, bottom are initialized
to l, t, r, b respectively.
CRect(const Rect& r);
Constructs a CRect object. Members a initialized to the corresponding values
of Rect r.
Member functions:
void SetRect(short l, short t, short r, short b);
Sets the dimensions of CRect to the specified values.
void SetRectEmpty();
Sets all coordinates to 0.
void InsetRect(short x, short y);
Shrinks or expands the CRect by the specified distance.
void OffsetRect(short x, short y);
Moves the CRect horizontally and vertically by the specified distance.
void OffsetRect(Point p);
Moves the CRect horizontally and vertically by values specified
in point p.
Boolean PtInRect(Point p);
Returns true if Point p is enclosed by CRect.
Boolean EmptyRect() const;
Returns true if CRect is empty. CRect is empty if either its height or width
is 0 or less.
Boolean NullRect() const;
Returns true if CRect is null. CRect is null if all coordinates are 0.
short Height(void);
Returns the height of CRect. The height is the distance between the top and
bottom borders.
short Width(void);
Returns the width of CRect. The width is the distance between the left and
right borders.
Boolean EqualRect(const Rect& r) const;
Returns true if the coordinates of CRect and r are equal.
CPoint& TopLeft();
Returns the top and left coordinates of CRect as a CPoint.
CPoint& BottomRight();
Returns the bottom and right coordinates of CRect as a CPoint.
void UnionRect(Rect& r1, Rect& r2);
Sets CRect to the smallest rectangle enclosing both r1 and r2.
void SectRect(Rect& r1, Rect& r2);
Sets CRect to the intersection of r1 and r2.
void EraseRect();
Quickdraw EraseRect. Fills CRect with the background pattern.
void FillRect(PatPtr thePat);
Quickdraw FillRect. Fills CRect with the specified pattern.
void FrameRect();
Quickdraw FrameRect. Draws the outline of CRect.
void InvertRect();
Quickdraw InvertRect. Inverts all pixels enclosed by CRect.
Operators:
void operator=(const Rect& r);
Sets the coordinates of CRect to the corresponding values of Rect r.
Boolean operator==(const Rect& r) const;
Returns true if CRect is equal to r.
Boolean operator!=(const Rect& r) const;
Returns true if CRect is not equal to r.
void operator+=(Point p);
Offsets CRect by p.
void operator-=(Point p);
Offsets CRect by negative p.
void operator|=(const Rect& r);
Sets CRect to the union of CRect and r.
void operator&=(const Rect& r);
Sets CRect to the intersection of CRect and r.
CRect operator+(Point p) const;
Returns a CRect that is offset by p.
CRect operator-(Point p) const;
Returns a CRect that is offset by negative p.
CRect operator|(const Rect& r) const;
Returns a CRect that is the union of CRect and r.
CRect operator&(const Rect& r) const;
Returns a CRect that is the intersection of CRect and r.